<!--Recharge_money 充值金额-->
<template>
  <div class="recharge">
    <div class="recharge-header">
      <mt-header title="充值">
        <router-link to="/account" slot="left">
          <mt-button icon="back"></mt-button>
        </router-link>
      </mt-header>
    </div>
    <div class="recharge-title">
      <p>请输入充值金额</p>
    </div>
    <div class="recharge-content">
     <div> <span>充值金额</span><input type="number" placeholder="0.00" v-model='rechargeMoney'></div>
    </div>
    <div class="recharge-footer">
      <button class='gradient' @click='recharge'>充值</button>
    </div>
  </div>
</template>
<script typy="text/ecmascript-6">
export default{
    data () {
        return {
            rechargeMoney:''
        }
    },
  methods:{
      recharge () {
          const that = this;
        if(parseInt(that.rechargeMoney) > 0){
          const params = {
              token:that.getToken(),
              money:that.rechargeMoney
          };
          const url = that.getUrl('home/pay');
          that.$http.post(url,params,{emulateJSON: true}).then(function (res) {
              if(res.data.code === 0){
                  that.$messagebox('提示', res.data.data).then(res => {
                      that.$router.go(-1);
              });
              }else {
                  this.$messagebox('提示', res.data.errMsg);
                  return false
              }
              that.message = '',
                  that.email = '',
                  that.phone = ''
          }, function (err) {
              that.$messagebox('提示', '找不到服务器，请稍后再试');
      })
  }else {
            that.$messagebox('提示', '请输入正确金额');
        }

      }
  }
}
</script>
<style  lang="less" rel="stylesheet/less">
  @import "../../lib/less/variable";
  .recharge{
    .recharge-header{
      header{
        background-color: #fff;
        color: #666;
      }
    }
    .recharge-title{
      .padding(0,10);
      .h(40);
      width: 100%;
      .lh(38);
      .fs(14);
    }
    .recharge-content{
      width: 100%;
      .h(40);
      .lh(38);
      background: #fff;
      div{
        .padding(0,10);
        .fs(14);
        input{
          color: #666;
          .ml(20)
        }
      }
    }
    .recharge-footer{
      width: 100%;
      .h(40);
      text-align: center;
      .pt(20);
      button{
        .w(150);
        .h(35);
        border: none;
        .fs(16)

      }
    }

  }
</style>
